public class LeetCode168 {
    public static void main(String[] args) {
        int columnNumber = 28;

        System.out.println(convertToTitle(columnNumber));
    }

    public static String convertToTitle(int columnNumber) {
        StringBuilder sb = new StringBuilder();
        //如果数为 0 就代表全部取完了
        while (columnNumber != 0) {
            columnNumber--;
            //加入字符
            sb.append((char) (columnNumber % 26 + 'A'));
            columnNumber /= 26;
        }
        return sb.reverse().toString();
    }
}
